﻿using d1Common;
using d1Common.WebController;
using d1Project.Modules.Common.do4A.Domain;
using d1Project.Modules.Common.do4A.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace d1Project.Modules.Common.do4A.Controllers.a2
{
    /// <summary>
    /// 发送验证码
    /// </summary>
    [Route("do4A/a2/VerificationCode")]
    public class VerificationCode2Controller : ControllerBase
    {
        protected override DbContext dbContext
        {
            get
            {
                return this.db;
            }
        }
        private do4ADbContext db = new do4ADbContext();

        public IHttpActionResult Get(string MobilePhone)
        {
            VerificationCode _verificationCode = VerificationCodeMgr.Instance.GetVerficationCode(AuthenticationMgr.Instance.Token2_VerficationLength, AuthenticationMgr.Instance.Token2_VerficationSpan);
            //IDoSms _IDoSms = doServices.Instance.Resolve<IDoSms>();
            //_IDoSms.sendMessage(MobilePhone, _verificationCode.Code, DateTime.Now);

            return Ok(new { VerificationId = _verificationCode.Id, VerificationCode = _verificationCode.Code });
        }
    }
}
